import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.ImageObserver;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * Contains graphic drawing code for numerals.
 *
 * @author Samantha Glassner <maiahtnamas@gmail.com>
 */
public class NumberGraphics extends JPanel
{
	//Creates number 
	int num;
	//Use to put multiple numbers together (i.e. 12 will have x = 0 for 1 but x = 200 for 2)
	int x = 0;
	static String z;
	
	//Sets number
	public NumberGraphics (int number)
	{
		num = number;
	}
	
	public void paintComponent(Graphics g)
	{
		g.setColor(Color.WHITE);
		g.fillRect(0, 0, 200, 300);
		//Sets Color
		g.setColor(Color.BLACK);
		
		switch(num)
		{
			case 0:
			{
				/**
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(25, 25, 25, 125, 25, 25); // top left
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(25, 125, 25, 125, 25, 25); // bottom left
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				*/
				//g.fillOval(25, 25, 125, 200);
				//g.setColor(Color.WHITE);
				//g.fillOval(50, 50, 75, 150);
				
				g.fillArc(25, 25, 125, 125, 0, 180);
				g.fillArc(25, 125, 125, 125, 180, 180);
				g.fillRoundRect(25, 75, 25, 125, 25, 25); // left
				g.fillRoundRect(125, 75, 25, 125, 25, 25); // right
				g.setColor(Color.WHITE);
				g.fillArc(50, 50, 75, 75, 0, 180);
				g.fillArc(50, 150, 75, 75, 180, 180);
				break;
			}
			case 1:
			{
				/**
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				 */
				g.fillRoundRect(75, 25, 25, 125, 25, 25); // top middle
				g.fillRoundRect(75, 125, 25, 125, 25, 25); // bottom middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom 
				int xpoints[] = {25, 75, 100, 45};
			    int ypoints[] = {125, 35, 35, 140};
			    int npoints = 4;
			    g.fillPolygon(xpoints, ypoints, npoints);
			    g.fillOval(25, 115, 25, 25);
				break;
			}
			case 2:
			{
				/**
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(25, 125, 25, 125, 25, 25); // bottom left
				*/
			    g.fillOval(25, 75, 25, 25);
			    g.fillOval(125, 75, 25, 25);
				g.fillArc(25, 25, 125, 125, 0, 180);
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				int xpoints[] = {25, 125, 150, 45};
			    int ypoints[] = {234, 87, 95, 248};
			    int npoints = 4;
			    g.fillPolygon(xpoints, ypoints, npoints);
				g.setColor(Color.WHITE);
				g.fillArc(50, 50, 75, 75, 0, 180);
				break;
			}
			case 3:
			{
				/**
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				*/
				g.fillRoundRect(25, 25, 100, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 100, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 100, 25, 25, 25); // bottom
				
				g.fillArc(75, 25, 75, 125, 270, 180);
				g.fillArc(75, 125, 75, 125, 270, 180);
				g.setColor(Color.WHITE);
				g.fillArc(100, 50, 25, 75, 270, 180);
				g.fillArc(100, 150, 25, 75, 270, 180);
				break;
			}
			case 4:
			{	
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 25, 25, 125, 25, 25); // top left
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				break;
			}
			case 5:
			{
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(25, 25, 25, 125, 25, 25); // top left
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				break;
			}
			case 6:
			{
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(25, 25, 25, 125, 25, 25); // top left
				g.fillRoundRect(25, 125, 25, 125, 25, 25); // bottom left
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				break;
			}
			case 7:
			{
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				break;
			}
			case 8:
			{
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(25, 25, 25, 125, 25, 25); // top left
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(25, 125, 25, 125, 25, 25); // bottom left
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				break;
			}
			case 9:
			{
				g.fillRoundRect(25, 25, 125, 25, 25, 25); // top
				g.fillRoundRect(25, 125, 125, 25, 25, 25); // middle
				g.fillRoundRect(25, 225, 125, 25, 25, 25); // bottom
				g.fillRoundRect(25, 25, 25, 125, 25, 25); // top left
				g.fillRoundRect(125, 25, 25, 125, 25, 25); // top right
				g.fillRoundRect(125, 125, 25, 125, 25, 25); // bottom right
				break;
			}
		}	
		//g.fillRoundRect(x + 25, 25, 125, 25, 25, 25); // top
		//g.fillRoundRect(x + 25, 125, 125, 25, 25, 25); // middle
		//g.fillRoundRect(x + 25, 225, 125, 25, 25, 25); // bottom
		//g.fillRoundRect(x + 25, 25, 25, 125, 25, 25); // top left
		//g.fillRoundRect(x + 125, 25, 25, 125, 25, 25); // top right
		//g.fillRoundRect(x + 25, 125, 25, 125, 25, 25); // bottom left
		//g.fillRoundRect(x + 125, 125, 25, 125, 25, 25); // bottom right
	}
	
	public static void main(String[] args)
	{
		JFrame window = new JFrame("Number Graphics");
		window.setBounds(300, 300, 175, 300);
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		NumberGraphics panel = new NumberGraphics(9); //Number placed between () = number displayed 
		panel.setBackground(Color.WHITE);
		Container c = window.getContentPane();
		c.add(panel);
		window.setVisible(true);
	}
}
